import request from '@/utils/request'
// 获取分类
export function getTypes(params) {
  return request({
    url: '/categories',
    params

  })
}

// 添加分类
export function addTypes(data) {
  return request({
    url: '/categories',
    method: 'post',
    data

  })
}

// 删除分类
export function delTypes(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'

  })
}
// 获取分类详情
export function getTypesDetails(id) {
  return request({
    url: `/categories/${id}`,
    method: 'get'
  })
}
// 更新分类
export function updateTypes(data) {
  return request({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}

// 获取分类条数
export function getTypesNum(params) {
  return request({
    url: '/categories/count',
    params
  })
}
